package cn.sdstudio.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * @author Zyq
 * @version 1.0
 * @date 2025/4/29 周二
 */

public enum BaseTravel implements BaseEnum {

    //交通工具选型
    DRIVING(0, "driving"),
    BUS(1, "transit"),
    RIDING(2, "riding"),
    WALKING(3, "walking");


    @EnumValue
    @JsonValue
    private final Integer code;
    private final String name;

    BaseTravel(Integer code, String name) {
        this.code = code;
        this.name = name;
    }


    @Override
    public Integer getCode() {
        return this.code;
    }

    @Override
    public String getName() {
        return this.name;
    }

//    @JsonCreator
//    public static BaseTravel fromCode(Integer code) {
//        for (BaseTravel travel : BaseTravel.values()) {
//            if (travel.code.equals(code)) {
//                return travel;
//            }
//        }
//        throw new IllegalArgumentException("无效的出行方式 code：" + code);
//    }
}
